package cn.happy.favdish.model.network

import cn.happy.favdish.model.entities.RandomDish
import io.reactivex.rxjava3.core.Single
import retrofit2.Retrofit
import retrofit2.adapter.rxjava3.RxJava3CallAdapterFactory
import retrofit2.converter.gson.GsonConverterFactory

/**
 * Author: created by ghappy on 2024/8/19 10:18
 *
 * Description:
 */
class RandomDishApiService {

    private val BASE_URL = "https://care.starice.com.cn/api/"

    private val api = Retrofit.Builder().baseUrl(BASE_URL)
        .addConverterFactory(GsonConverterFactory.create())
        .addCallAdapterFactory(RxJava3CallAdapterFactory.create())
        .build()
        .create(RandomDishAPI::class.java)

    fun getRandomDish(): Single<RandomDish.Recipes> {
        return api.getRandomDishes()
    }
}